package com.cn.yunhe.struts.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

/**
 * 会话拦截器
 * 
 * @author YUNHE
 *
 */
public class SessionInterceptor extends MethodFilterInterceptor{


	private static final long serialVersionUID = 1L;

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		
		
		Map<String,Object> session = invocation.getInvocationContext().getSession();
		if(session.get("userid")==null){
			return "error";
		}
		
		System.out.println("会话拦截器。。。开始");
		
		String result = invocation.invoke();
		
		System.out.println("会话拦截器。。。结束");

		return result;
	}


}
